package enemyPackage;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.ImageIcon;

import utilPackage.Commons;

public class MegaBomb extends Bomb implements Commons{
    
    
    protected String bomb = "../Image/alien_bomb.gif";
    private int randomDepthExplode;
    
    
    public MegaBomb(int x, int y) {
        super(x,y);
        setDestroyed(true);
        this.x = x;
        this.y = y;
        ImageIcon ii = new ImageIcon(this.getClass().getResource(bomb));
        setImage(ii.getImage());
        setBombSpeed((Math.random()* 3) + 1);
        width = MEGABOMB_WIDTH;
        height = MEGABOMB_HEIGHT;
        
        setRandomDepthExplode(BOARD_HEIGTH/2 + (int)(Math.random() * ((BOARD_HEIGTH-25 - BOARD_HEIGTH/2) + 1)));
        
    }

	public void setRandomDepthExplode(int randomDepthExplode) {
		this.randomDepthExplode = randomDepthExplode;
	}

	public int getRandomDepthExplode() {
		return randomDepthExplode;
	}
	
	public void drawMegaBomb(Graphics g){
		
		double r = Math.random();
		
		if(r < .33){
			for(int i = 0; i < 10; i++){
				
				g.setColor(new Color(255 ,0, 216, 100));
				g.drawOval(x-2+i, y-1+i, MEGABOMB_WIDTH-(i*2), MEGABOMB_HEIGHT-(i*2));
			}
		}
		else if(r < .66){
			for(int i = 0; i < 10; i++){
				
				g.setColor(new Color(255 ,255, 255, 100));
				g.drawOval(x+1+i, y-1+i, MEGABOMB_WIDTH-(i*2), MEGABOMB_HEIGHT-(i*2));
			}
		}
		else {
			for(int i = 0; i < 10; i++){
				
				g.setColor(new Color(255 ,0, 216, 150));
				g.drawOval(x-1+i, y-1+i, MEGABOMB_WIDTH-(i*2), MEGABOMB_HEIGHT-(i*2));
			}
		}
		
	}

}
